<%= form_remote_tag :url      => {:action => 'comment', :id => @article},
                    :position => :bottom,
                    :update   => {:success => 'commentList'},
                    :loading  => "loading()",
                    :complete => "complete(request)",
                    :failure  => "failure(request)",
                    :html     => {:id => 'commentform', :class => 'comments' } %>

<div id="preview" style="display:none"></div>

<fieldset>
  <legend>Comments</legend>
  <p>
    <label>Name:<br />
      <%= text_field "comment", "author" %>
      <small>(<%= link_to_function("leave url/email &#187;", "Effect.toggle('extra_fields', 'blind', {duration: .3})") %>)</small>
    </label>
  </p>

  <div id="extra_fields" style="display:none;">
      <p>
        <label>Email: <%= content_tag('small', "(#{link_to('gravatar', 'http://gravatar.com')} enabled)") if this_blog.use_gravatar %><br />
          <%= text_field "comment", "email" %>
        </label>
      </p>
      <p>
        <label>Url:<br />
          <%= text_field "comment", "url" %>
        </label>
      </p>
  </div>

  <p>
    <label>
      Comments:
      <%= content_tag('small', link_to("Textile enabled", "http://hobix.com/textile/")) if this_blog.comment_text_filter.include? 'textile' %>
      <%= content_tag('small', link_to("Markdown enabled", "http://daringfireball.net/projects/markdown/")) if this_blog.comment_text_filter.include? 'markdown' %>
      <br />
      <%= text_area 'comment', 'body' %>
    </label>
  </p>

  <p>
    <%= submit_to_remote('preview', 'Preview!',
                         :update => 'preview',
                         :complete => "Element.show('preview')",
                         :url    => { :action => 'comment_preview' }) %>
    <%= submit_tag 'Submit', :id => 'form-submit-button',  :onclick => "$('commentform').onsubmit();this.disabled=true;Element.hide('preview');return false;" %>
    <%= image_tag '/images/theme/spinner.gif', :id => 'comment_loading', :style => 'display:none' %>
  </p>
</fieldset>
<%= end_form_tag %>
